﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Subplicity.Controllers
{
    public class ScheduleController : BaseController
    {
        //
        // GET: /Schedule/

        public ActionResult Index()
        {
            ClassService.ClassService classService = new ClassService.ClassService();
            ClassService.GetClassesRequest classRequest = new ClassService.GetClassesRequest();
            classRequest.SourceCredentials = new ClassService.SourceCredentials();
            classRequest.SourceCredentials.SourceName = sourcename;
            classRequest.SourceCredentials.Password = password;
            classRequest.SourceCredentials.SiteIDs = siteIDs;

            classRequest.StaffIDs = new long[] { StaffID };
            classRequest.XMLDetail = ClassService.XMLDetailLevel.Full;
            classRequest.StartDateTime = DateTime.Now.AddDays(-3);
            classRequest.EndDateTime = DateTime.Now.AddDays(7);
            classRequest.CurrentPageIndex = 0;
            classRequest.PageSize = 20;
            ClassService.GetClassesResult classScheduleResult = classService.GetClasses(classRequest);


            //var model = classScheduleResult.Classes.GroupBy(m => m.Location.Name );

            return View(classScheduleResult.Classes.ToList());
            
        }

        public ActionResult SubRequest(string classID)
        {
           return Content(classID);
        }

    }
}
